package net.wsfcp.android.http.mvp.presenter;

import net.wsfcp.android.base.BasePresenter;
import net.wsfcp.android.bean.resultbean.OrderQuantityBean;
import net.wsfcp.android.http.mvp.IModel;
import net.wsfcp.android.http.mvp.contract.OrderListContract;
import net.wsfcp.android.http.mvp.model.OrderListModel;
import net.wsfcp.android.ui.view.my.activity.OrderListActivity;

import java.util.HashMap;

/**
 * Created by Shaoboyang on 2018/12/14.
 */

//获取订单数量
public class OrderActivityPresenter extends BasePresenter<OrderListActivity> implements
        OrderListContract.OrderListActivityPresenter {


    @Override
    public void getOrderQuantity() {
        ((OrderListModel) getiModelMap().get("orderQuantity")).getOrderQuantity(new OrderListModel
                .GetOrderQuantityInfoHint() {
            @Override
            public void getOrderQuantitySuccessInfo(OrderQuantityBean orderQuantityBean) {
                getIView().getOrderQuantitySuccess(orderQuantityBean);
            }

            @Override
            public void getOrderQuantityFailInfo(String str) {
                getIView().getOrderQuantityFail(str);
            }


        });
    }


    @Override
    public HashMap<String, IModel> getiModelMap() {
        return loadModelMap(new OrderListModel());
    }

    @Override
    public HashMap<String, IModel> loadModelMap(IModel... models) {
        HashMap<String, IModel> map = new HashMap<>();
        map.put("orderQuantity", models[0]);
        return map;
    }


}
